new Vue({
    el:".container",
    data:{
        limitNum:3,
        shippingMethod:1,
        curentIndex:'',
        addressList:[],
    },
    mounted:function () {//初始化加载
        this.$nextTick(function () {
            this.getAddressList()
        })
    },
    //应用于v-for中的过滤器
    computed:{
        filterAddressList:function () {
            return this.addressList.slice(0,this.limitNum);
        }
    },
    methods:{
        //获取地址列表
        getAddressList:function () {
            var _this=this;
            this.$http.get("data/address.json").then(function (res) {
                console.log(res.data.result);
                if(res.status=="200"){
                    _this.addressList=res.data.result;
                }
            })
        },
    //    设为默认
        setDefault:function (addressId) {
            this.addressList.forEach(function (address,index) {
                if(address.addressId==addressId){
                    address.isDefault=true;
                }else{
                    address.isDefault=false;
                }
            })
        },
    }
})